#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;

void partition(vector<int> &permutation, int k, int n){


    const long long M=998244353;

    long long max = 0;
    long long num = 1;
    int prev = 0;
    for (int i = 0; i < n ; i++) {
        if (permutation[i] > n - k) {
            max += permutation[i];
            if (i > 0) {
                num = (num * (i - prev)) % M;
            } 
            prev = i;
        }        
    }

    printf("%lld %lld\n", max, num);
}
int main(){
    int n, k;
    cin >> n >> k;
    vector<int> permutation(n);
    for (int i = 0; i < n ; i++) {
        cin >> permutation[i];
    }
    partition(permutation, k, n);
    return 0;
}